@extends("admin.public.layout")

@section("content")

    <div class="container-xxl flex-grow-1 container-p-y">



        <div class="card">
            <div class="card-header">
                <div class="row">
                    <div class="col-md-10">
                        <h5>{{$pageName}}</h5>
                    </div>
                    <div class="col-md-2">
                        <a class="btn btn-primary" href="{{route("adminUserCreate")}}"><i class="ti ti-circle-plus me-1"></i>添加用户</a>
                    </div>
                </div>
            </div>
            <div class="card-body">
            <div class="table-responsive text-nowrap">
                <table class="table">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>用户名</th>
                        <th>用户手机号</th>
                        <th>用户角色</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody class="table-border-bottom-0">


                    @foreach($users as $user)
                        <tr>
                            <td>{{$user->id}}</td>
                            <td>{{$user->user_name}}</td>
                            <td>{{$user->user_phone}}</td>
                            <td>{{$roles[$user->role_id]}}</td>
                            <td>
                                <div class="dropdown">
                                    <button type="button" class="btn p-0 dropdown-toggle hide-arrow" data-bs-toggle="dropdown">
                                        <i class="ti ti-dots-vertical"></i>
                                    </button>
                                    <div class="dropdown-menu">
                                        <a class="dropdown-item" href="{{route("adminUserEdit", ['id' =>$user->id])}}"><i class="ti ti-pencil me-1"></i> 编辑</a>
                                        <a class="dropdown-item" href="{{route("adminUserDelete",['id' =>$user->id])}}"><i class="ti ti-trash me-1"></i> 删除</a>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    @endforeach

                    </tbody>
                </table>
            </div>
            </div>
        </div>
    </div>
    <!-- / Content -->

@endsection
